<template>
	<view class="like">
		<view class="header">
			<text>已收藏{{arr.length}}个餐宴</text>
			<text @click="clearcar">清空</text>
		</view>
		<view class="center" v-for="(item,index) in arr" :key="item.id">
			<image :src="item.imageURL" mode=""></image>
			<view class="text">
				<view class="text-left">
					<view class="">
						{{item.title}}
					</view>
					<view class="">
						￥{{item.price}}/桌
					</view>
				</view>
				<view class="text-rght">
					<text @click="Delete">删除</text>
				</view>
			</view>
		</view>
	</view>
	
</template>

<script>
	export default {
		data() {
			return {
				arr:[
					{id:0, imageURL:'../../static/image/images/goods3.jpg',title:'麻辣小龙虾',price:188},
					{id:1, imageURL:'../../static/image/images/goods2.jpg',title:'麻辣小龙虾',price:188},
					{id:2, imageURL:'../../static/image/images/goods1.jpg',title:'麻辣小龙虾',price:188},
					{id:3, imageURL:'../../static/image/images/goods3.jpg',title:'麻辣小龙虾',price:188}
				]
			}
		},
		methods: {
			clearcar() {
				this.arr = []
				console.log("点击了清空")
			},
			Delete(index) {
				console.log(index)
				this.arr.splice(index,1)
			}
		}
	}
</script>

<style>
	.header {
		display: flex;
		justify-content: space-around;
	}
	.center {
		width: 80%;
		margin: 0 auto;
		border-radius: 20px;
		border: 1px solid #ccc;
		margin-top: 10px;
	}
	.center image{
		width: 100%;
		border-top-left-radius: 20px;
		border-top-right-radius: 20px;
	}
	.text {
		display: flex;
		align-items: center;
		justify-content: space-around;
	}
	
</style>
